using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using NUnit.Framework;
using QLNhaSach.BUS;
using QLNhaSach.BUS.DTO;
using QLNhaSach.DAO;

namespace QLNhaSach_UnitTest
{
    [TestFixture]
    public class HoaDonDAO_test
    {
        [Test]
        public void DSHD_test()
        {
            DataTable dt = HoaDonDAO.DSHD();
            int gt = dt.Rows.Count;
            int kt = 41;
            Assert.AreEqual(gt,kt);
        }

        [Test]
        public void HDMotKH_test()
        {
            KhachHangDTO kh = new KhachHangDTO();
            kh.MaKH = 3;
            DataTable dt = HoaDonDAO.HDMotKH(kh);
            int gt = dt.Rows.Count;
            int kt = 15;
            Assert.AreEqual(kt,gt);
        }

        [Test]
        public void XoaHoaDonDAO_test()
        {
            DataTable dt = HoaDonDAO.DSHD();
            int before = dt.Rows.Count;
            HoaDonDTO hd = new HoaDonDTO();
            hd.MaHD = 5;
            if (HoaDonDAO.XoaHoaDon(hd))
            {
                dt = HoaDonDAO.DSHD();
                int late = dt.Rows.Count;
                Assert.AreNotEqual(before, late);
            }
        }
    }
}
